<?php

class User extends BaseModel
{

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'user';
	}

    public function rules()
    {
        return array(
            array('user_name, password, role', 'required', 'message'=>'{attribute} 不能为空'),
            array('user_name', 'unique'), 
        );
    }

    /**
     *
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'user_id'   =>  '用户',
            'user_name' =>  '用户名',
            'password'  =>  '密码',
            'role'      =>  '角色',
        );
    }
}
